﻿#include "customdelegate.h"

myDelegate::myDelegate()
{

}

void myDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    if(option.state.testFlag(QStyle::State_Selected))//选中
    {
        QRect rect=option.rect;
        rect.setWidth(rect.width()/2);
        painter->fillRect(rect,QBrush(Qt::red));

    }
}
